package com.cryptoneedle.center.common.repository.ods;

import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.center.common.entity.ods.OdsColumn;
import com.cryptoneedle.center.common.key.ColumnKey;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>description: Ods-Column </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
public interface OdsColumnRepository extends BaseRepository<OdsColumn, ColumnKey> {

    @Query("FROM OdsColumn ORDER BY catalogName, databaseName, tableName, ordinalPosition")
    List<OdsColumn> list();

    @Query("FROM OdsColumn WHERE catalogName = :catalogName AND databaseName = :databaseName ORDER BY catalogName, databaseName, tableName, ordinalPosition")
    List<OdsColumn> listByDatabase(String catalogName, String databaseName);

    @Query("FROM OdsColumn WHERE catalogName = :catalogName AND databaseName = :databaseName AND tableName = :tableName ORDER BY catalogName, databaseName, tableName, ordinalPosition")
    List<OdsColumn> listByTable(String catalogName, String databaseName, String tableName);
}